package com.ruoyi.project.WebMoudle.userExchange.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.userExchange.mapper.UserExchangeMapper;
import com.ruoyi.project.WebMoudle.userExchange.domain.UserExchange;
import com.ruoyi.project.WebMoudle.userExchange.service.IUserExchangeService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 积分兑换记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-20
 */
@Service
public class UserExchangeServiceImpl implements IUserExchangeService 
{
    @Autowired
    private UserExchangeMapper userExchangeMapper;

    /**
     * 查询积分兑换记录
     * 
     * @param id 积分兑换记录ID
     * @return 积分兑换记录
     */
    @Override
    public UserExchange selectUserExchangeById(Long id)
    {
        return userExchangeMapper.selectUserExchangeById(id);
    }

    /**
     * 查询积分兑换记录列表
     * 
     * @param userExchange 积分兑换记录
     * @return 积分兑换记录
     */
    @Override
    public List<UserExchange> selectUserExchangeList(UserExchange userExchange)
    {
        return userExchangeMapper.selectUserExchangeList(userExchange);
    }

    /**
     * 新增积分兑换记录
     * 
     * @param userExchange 积分兑换记录
     * @return 结果
     */
    @Override
    public int insertUserExchange(UserExchange userExchange)
    {
        userExchange.setCreateTime(DateUtils.getNowDate());
        return userExchangeMapper.insertUserExchange(userExchange);
    }

    /**
     * 修改积分兑换记录
     * 
     * @param userExchange 积分兑换记录
     * @return 结果
     */
    @Override
    public int updateUserExchange(UserExchange userExchange)
    {
        userExchange.setUpdateTime(DateUtils.getNowDate());
        return userExchangeMapper.updateUserExchange(userExchange);
    }

    /**
     * 删除积分兑换记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteUserExchangeByIds(String ids)
    {
        return userExchangeMapper.deleteUserExchangeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除积分兑换记录信息
     * 
     * @param id 积分兑换记录ID
     * @return 结果
     */
    @Override
    public int deleteUserExchangeById(Long id)
    {
        return userExchangeMapper.deleteUserExchangeById(id);
    }

    @Override
    public List<UserExchange> queryExchangeLog(Long wxUserId, String month) {
        return userExchangeMapper.queryExchangeLog(wxUserId,month);
    }
}
